//
//  DayTableViewCell.m
//  兼职页面
//
//  Created by kuiyuan liang on 2021/6/7.
//

#import "DayTableViewCell.h"
#import "CommonUtil.h"

@interface DayTableViewCell()
@property (strong, nonatomic) UIView * whiteView;
@property (strong, nonatomic) UILabel * tipLabel;
@property (strong, nonatomic) UILabel * tipLabel2;
@property (strong, nonatomic) UIButton * zanBtn;
@property (strong, nonatomic) UIView * lineView;

@property (strong, nonatomic) UIImageView * moneyImageView;
@property (strong, nonatomic) UILabel * moneyLabel;
@end

@implementation DayTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self.contentView addSubview:self.whiteView];
        [self.whiteView addSubview:self.tipLabel];
        [self.whiteView addSubview:self.tipLabel2];
        [self.whiteView addSubview:self.zanBtn];
        [self.whiteView addSubview:self.moneyImageView];
        [self.whiteView addSubview:self.moneyLabel];
        [self.whiteView addSubview:self.lineView];
    }
    return self;
}

- (void)zanBtnClick:(UIButton *)sender{
    NSLog(@"%@",sender.titleLabel.text);
}

-(UIView *)whiteView{
    if (!_whiteView) {
        _whiteView = [[UIView alloc] initWithFrame:CGRectMake(AD(15), 0, SCREEN_WIDTH-AD(30), AD(100))];
        _whiteView.backgroundColor = [UIColor whiteColor];
    }
    return _whiteView;
}

-(UILabel *)tipLabel{
    if (!_tipLabel) {
        _tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(AD(10), AD(20), AD(120), AD(25))];
        _tipLabel.textColor = RGB(30, 30, 30);
        _tipLabel.font = [UIFont systemFontOfSize:AD(16)];
        _tipLabel.text = @"邀请好友";
    }
    return _tipLabel;
}

-(UILabel *)tipLabel2{
    if (!_tipLabel2) {
        _tipLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(AD(10), _tipLabel.bottom + AD(5), _whiteView.width-AD(120), AD(50))];
        _tipLabel2.textColor = RGB(255, 142, 88);
        _tipLabel2.font = [UIFont systemFontOfSize:AD(14)];
        _tipLabel2.text = @"每成功邀请一位好友注册登录奖励您1.0元";
        _tipLabel2.numberOfLines = 0;
    }
    return _tipLabel2;
}


-(UIButton *)zanBtn{
    if (!_zanBtn) {
        _zanBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _zanBtn.backgroundColor = RGB(255, 97, 31);
        [_zanBtn setTitle:@"去邀请" forState:UIControlStateNormal];
        [_zanBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _zanBtn.titleLabel.font = [UIFont systemFontOfSize:AD(15)];
        [_zanBtn addTarget:self action:@selector(zanBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        _zanBtn.frame = CGRectMake(0, AD(10), AD(80), AD(35));
        _zanBtn.layer.cornerRadius = _zanBtn.height/2;
        _zanBtn.right = _whiteView.width - AD(10);
        _zanBtn.centerY = self.whiteView.centerY;
    }
    return _zanBtn;
}
-(UIImageView *)moneyImageView{
    if (!_moneyImageView) {
        _moneyImageView = [[UIImageView alloc] initWithFrame:CGRectMake(AD(150), _tipLabel.top, AD(25), AD(25))];
        _moneyImageView.backgroundColor = [UIColor redColor];
        _moneyImageView.layer.cornerRadius = AD(12.5);
        _moneyImageView.clipsToBounds = YES;
    }
    return _moneyImageView;
}
-(UILabel *)moneyLabel{
    if (!_moneyLabel) {
        _moneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(_moneyImageView.right +AD(3),  _tipLabel.top, AD(80), AD(25))];
        _moneyLabel.textColor = RGB(30, 30, 30);
        _moneyLabel.font = [UIFont systemFontOfSize:AD(16)];
        _moneyLabel.text = @"+1.00";
    }
    return _moneyLabel;
}

-(UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(0, AD(99), self.whiteView.width, AD(1))];
        _lineView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    }
    return _lineView;
}

@end
